<?php

/**
 * Validator for {@link User}.
 * @see UserMapper
 */
final class TodoValidator {

    private function __construct() {
        
    }

    /**
     * Validate the given {@link Todo} instance.
     * @param Todo $todo {@link Todo} instance to be validated
     * @return array array of {@link Error} s
     */
    public static function validate(User $user) {
        $errors = array();
        if (!trim($user->getUsername())) {
            $errors[] = new Error('username', 'Username cannot be empty.');
        }
        if (!trim($user->getPassword())) {
            $errors[] = new Error('password', 'Password cannot be empty.');
        }
        return $errors;
    }

}

?>
